Using Arrays

Using arrays can simplify a model. Suppose you need to model an assembly line that attaches components to a computer motherboard. Furthermore, you want to track the usage of component parts over time. Without an array, hundreds of individual entities of various types would have to represent hundreds of individual components. Keeping track of all the components would be very complex, not to mention all of the join operations and routings for performing the assembly. Instead, various cells in a one-dimensional array could track the number of each type of component used during the simulation.

An array can do the job more efficiently. The initial inventory level for each component could be stored in an external file and read into the cells of the array at the start of the simulation. The first cell might contain the inventory level of transistors; the second could contain the inventory level of capacitors and so on. When a motherboard arrives at the location adding the components, each cell’s value is decremented according to the number of that type of component joined to the motherboard. If each motherboard requires twelve transistors and five capacitors, then every time a motherboard arrives at the location, the array’s first cell is reduced by twelve and the second cell is reduced by five. Thus the model becomes much less complex because it requires fewer entities and less logic.